package cn.com.io.day20151210;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 * 使用PrintStream处理流来包装InputStream,使用处理流后的输出流在输出时将更加方便
 */
public class PrintStreamTest {
    public static void main(String[] args){
        PrintStream print = null;
        try {
            FileOutputStream outputStream = new FileOutputStream("PrintStreamTest.txt");//创建节点输出流
            print = new PrintStream(outputStream);//使用PrintStream来包装FileOutputStream
            print.println("PrintStream处理流测试!");
            print.println(new PrintStreamTest());

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }finally {
            if (print != null){
                print.close();
            }
        }
    }
}
